package com.boot.leetcode;

/**
 * @Package com.boot.leetcode
 */
public class StringTester {

    public static synchronized void a(){
        try {
            Thread.sleep(5000l);
            System.out.println("a doing");
            return;
        }catch (Exception e){

        }finally {
            System.out.println("ssss");
        }
    }

    public static void b(){
        try {
            synchronized (StringTester.class){
                System.out.println("b doing");
            }
            return;
        }catch (Exception e){

        }finally {
            System.out.println("ssss");
        }
    }

    public synchronized void c(){
        try {
            System.out.println("c doing");
            return;
        }catch (Exception e){

        }finally {
            System.out.println("ssss");
        }
    }

    public static void main(String[] args) {
        new Thread(()->a()).start();
        new Thread(()->b()).start();
        final StringTester s =new StringTester();
        new Thread(()->s.c()).start();

    }
}
